package com.compass.mobile.presenters;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.leanback.widget.Presenter;

import com.compass.mobile.R;
import com.compass.mobile.models.Title;

/**
 * Description： 自主开单 menu presenter
 * Date:2024/5/22 10:24
 */
public class BillingPresenter extends Presenter {
    @Override
    public BillingPresenter.ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
        View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_case_title, viewGroup, false);
        return new BillingPresenter.ViewHolder(view);

    }

    @Override
    public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item) {
        if (item instanceof Title) {
            BillingPresenter.ViewHolder vh = (BillingPresenter.ViewHolder) viewHolder;
            vh.tvTitle.setText(((Title) item).getName());
            vh.imgIcon.setVisibility(View.INVISIBLE);
        }
    }

    @Override
    public void onUnbindViewHolder(Presenter.ViewHolder viewHolder) {

    }


    static class ViewHolder extends Presenter.ViewHolder {
        TextView tvTitle;
        ImageView imgIcon;

        public ViewHolder(View view) {
            super(view);
            tvTitle = view.findViewById(R.id.tv_title);
            imgIcon = view.findViewById(R.id.imgIcon);

        }

    }
}
